package main

import (
	"os"
	"fmt"
)

func main()  {

	test1()


}

func test1()  {
	//abcdefg
	path := "/home/daniel/tmp/f01.text"

	file,_ := os.OpenFile(path, os.O_RDWR, os.ModePerm)
	bs := []byte{0}

	file.Read(bs)
	fmt.Println(bs)
	fmt.Println(string(bs))

	file.Read(bs)
	fmt.Println(string(bs))

	file.Seek(4,0)
	file.Read(bs)
	fmt.Println(string(bs))

	//file.Seek(0,0)
	//file.Read(bs)
	//fmt.Println(string(bs))

	//file.Seek(6,0)
	//file.Read(bs)
	//fmt.Println(string(bs))

	file.Seek(3,1)
	file.Read(bs)
	fmt.Println(string(bs))

	file.Seek(0,2)	//文件末尾
	file.WriteString("ABC")

}


